package com.littleken.controller;

import com.littleken.entity.User;
import com.littleken.service.UserService;
import com.littleken.service.impl.UserServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/UserTable")
public class UserListServlet extends HttpServlet {
    UserService service =new UserServiceImpl();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        List<User> userList = service.getAllUser();
        req.getSession().setAttribute("userList",userList);
        resp.sendRedirect("UserTable.jsp");
    }
}
